package com.esri.core.map;

import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.util.d;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class Bookmark {
    SpatialReference a;
    Envelope b;
    String c;

    public SpatialReference getSpatialReference() {
        return this.a;
    }

    public Envelope getExtent() {
        return this.b;
    }

    public String getName() {
        return this.c;
    }

    public String toString() {
        return "Bookmark [spatialReference=" + this.a + ", extent=" + this.b + ", name=" + this.c + "]";
    }

    public static Bookmark fromJson(JsonParser jsonParser) throws Exception {
        if (d.c(jsonParser)) {
            Bookmark bookmark = new Bookmark();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if (currentName.equals("extent")) {
                    bookmark.b = new Envelope();
                    while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                        String currentName2 = jsonParser.getCurrentName();
                        jsonParser.nextToken();
                        if (currentName2.equals("spatialReference")) {
                            bookmark.a = SpatialReference.fromJson(jsonParser);
                        } else if (currentName2.equals("xmax")) {
                            bookmark.b.setXMax(jsonParser.getDoubleValue());
                        } else if (currentName2.equals("xmin")) {
                            bookmark.b.setXMin(jsonParser.getDoubleValue());
                        } else if (currentName2.equals("ymax")) {
                            bookmark.b.setYMax(jsonParser.getDoubleValue());
                        } else if (currentName2.equals("ymin")) {
                            bookmark.b.setYMin(jsonParser.getDoubleValue());
                        } else {
                            jsonParser.skipChildren();
                        }
                    }
                } else if (currentName.equals("name")) {
                    bookmark.c = jsonParser.getText();
                } else {
                    jsonParser.skipChildren();
                }
            }
            return bookmark;
        }
        return null;
    }
}
